package cn.jari.erp.inventory.entities.primary;
import cn.jari.erp.inventory.entities.primary.InventoryCategory;
import com.csicit.ace.jpaleaf.LeafIdGenerator;
import com.csicit.ace.jpaleaf.entity.SourceIdentifiedAndVersionedEntity;
import com.csicit.ace.jpautils.recycle.RecyclableEntity;
import com.csicit.ace.model.PropertyAccess;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.annotations.GenericGenerator;
import java.util.Objects;
import org.hibernate.Hibernate;
import javax.persistence.*;
import lombok.Getter;
import lombok.Setter;

/*
 * 警告：代码由鲲舟平台生成，请勿手动修改。
 * Warn: This class file is generated by JARI-ACE platform, please do not modify manually。
 */

/**
 * 存货档案的实体基类
 * 
 *
 * @author JARI-ACE
 */
@Getter
@Setter
@MappedSuperclass
public abstract class AbstractInventoryItem implements SourceIdentifiedAndVersionedEntity<String>, RecyclableEntity {
    /**
     * 主键
     */
    @Column(name = "id")
    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = LeafIdGenerator.GENERATOR_NAME)
    @GenericGenerator(name = LeafIdGenerator.GENERATOR_NAME, strategy = LeafIdGenerator.CLASS_NAME)
    private String id = null;
    /**
     * 是否已回收
     */
    @Column(name = "recycled")
    private Boolean recycled = null;
    /**
     * 回收键
     */
    @Column(name = "recycle_index")
    private String recycleIndex = null;
    /**
     * 数据版本
     */
    @Column(name = "data_version")
    @Version
    private Long dataVersion = null;
    /**
     * 密级
     */
    @Column(name = "classification_level")
    private Short classificationLevel = null;
    /**
     * 创建用户ID
     */
    @Column(name = "created_by_user")
    private String createdByUser = null;
    /**
     * 创建用户姓名
     */
    @Column(name = "created_by_user_name")
    private String createdByUserName = null;
    /**
     * 创建部门ID
     */
    @Column(name = "created_by_dept")
    private String createdByDept = null;
    /**
     * 创建部门名称
     */
    @Column(name = "created_by_dept_name")
    private String createdByDeptName = null;
    /**
     * 创建用户域名
     */
    @Column(name = "created_by_realm_name")
    private String createdByRealmName = null;
    /**
     * 创建时间
     */
    @Column(name = "created_time")
    private LocalDateTime createdTime = null;
    /**
     * 发布源站点ID
     */
    @Column(name = "release_source")
    private String releaseSource = null;
    /**
     * 源ID
     */
    @Column(name = "source_id")
    private String sourceId = null;
    /**
     * 存货类别
     */
    @ManyToOne
    @JoinColumn(name = "inventory_category_id")
    private InventoryCategory inventoryCategory = null;
    public InventoryCategory getInventoryCategory() {
        return PropertyAccess.read(this.getClass(), "inventoryCategory", inventoryCategory);
    }
    public void setInventoryCategory(InventoryCategory value) {
        PropertyAccess.write(this.getClass(), "inventoryCategory", () -> inventoryCategory = value);
    }
    /**
     * 存货名称
     */
    @Column(name = "name")
    private String name = null;
    /**
     * 计量单位
     */
    @Column(name = "units")
    @ElementCollection
    @CollectionTable(name = "iv_inventory_item_units", joinColumns = @JoinColumn(name = "inventory_item_id"))
    @OrderColumn(name = "sort_index")
    private List<String> units = new ArrayList<>();
    public void setUnits(List<String> value) {
        PropertyAccess.write(this.getClass(), "units", () -> units = value);
    }
    /**
     * aaaaaa
     */
    @Column(name = "aaaaaaa")
    private String aaaaaaa = null;

}